package com.twu.biblioteca;

public class ReserveController extends AbstractController {

    private BookManager bookManager;

    public void setBookManager(BookManager bookManager) {
        this.bookManager = bookManager;
    }

    public void enter() {
        getUserInterface().prompt("Please insert book title:");
    }

    public Controller handle(String input) {
        return reserve(input);
    }

    /* default */ Controller reserve(String book) {
        boolean reservationResult = bookManager.reserveBook(book);
        if (reservationResult == true) {
            getUserInterface().showReservationSucceededMessage();
        } else {
            getUserInterface().showReservationFailedMessage();
        }
        return null;
    }

}
